/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Not Stephen
 */
public class Database {
    public static Connection connection;
    public static Connection getConnection(){
        if(connection == null){
            if(createConnection()){
                return connection;
            }
            else{
            return null;
            }
        }
        else{
            return connection;
        }
    }
    public static boolean createConnection(){
        try {
            connection = DriverManager.getConnection("jdbc:mysql://mysql2.cs.stonybrook.edu:3306/cse308team1","cse308team1","changeit");
        } catch (SQLException ex) {
           System.out.println("Connection Not Created");System.out.println("Connection Not Created");
           System.out.println("Connection Not Created");System.out.println("Connection Not Created");
           return false;
        }
        return true;
    }
    
}
